package com.pet.server.po;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Transient;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Formula;

/**
 * PetInfo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "request_info")
public class RequestInfo implements java.io.Serializable {

	// Fields

	private Integer id;
	//提问用户
	private Integer userId;
	//类型
	private String type;
	//问题
	private String question;
	private String state;
	private Integer score;
	//采纳问题id
	private Integer answerId;
	//时间
	private Date createTime;
	//用户昵称
	private String nickName;
	//回答
	private String answerText;
	//会员
	private String sessionid;
	
	// Constructors

	/** default constructor */
	public RequestInfo() {
	}


	public RequestInfo(Integer id, Integer userId, String type,
			String question, String state, Integer score, Integer answerId,
			Date createTime, String nickName) {
		super();
		this.id = id;
		this.userId = userId;
		this.type = type;
		this.question = question;
		this.state = state;
		this.score = score;
		this.answerId = answerId;
		this.createTime = createTime;
		this.nickName = nickName;
	}


	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return id;
	}

	
	public void setId(Integer id) {
		this.id = id;
	}


	
	@Column(name = "type", nullable = false, length = 20)
	public String getType() {
		return type;
	}


	/**
	 * @param type the type to set
	 */
	public void setType(String type) {
		this.type = type;
	}



	@Column(name = "question", nullable = false, length = 512)
	public String getQuestion() {
		return question;
	}


	/**
	 * @param question the question to set
	 */
	public void setQuestion(String question) {
		this.question = question;
	}


	/**
	 * @return the state
	 */
	@Column(name = "state", nullable = false, length = 32)
	public String getState() {
		return state;
	}


	/**
	 * @param state the state to set
	 */
	public void setState(String state) {
		this.state = state;
	}


	/**
	 * @return the score
	 */
	@Column(name = "score", nullable = false, length = 32)
	public Integer getScore() {
		return score;
	}


	/**
	 * @param score the score to set
	 */
	public void setScore(Integer score) {
		this.score = score;
	}


	/**
	 * @return the answerId
	 */
	@Column(name = "answer_id", nullable = false, length = 32)
	public Integer getAnswerId() {
		return answerId;
	}


	/**
	 * @param answerId the answerId to set
	 */
	public void setAnswerId(Integer answerId) {
		this.answerId = answerId;
	}


	@Column(name = "user_id", nullable = false)
	public Integer getUserId() {
		return this.userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	@Column(name = "create_time", nullable = false, length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}


	@Formula("(SELECT f.nick_name FROM user_info f WHERE f.user_id=user_id)")
	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}


	@Formula("(SELECT f.answer_text FROM answer_info f WHERE f.answer_id=answer_id)")
	public String getAnswerText() {
		return answerText;
	}
	

	public void setAnswerText(String answerText) {
		this.answerText = answerText;
	}


	@Formula("(SELECT f.sessionid FROM answer_info f WHERE f.answer_id=answer_id)")
	public String getSessionid() {
		return sessionid;
	}

	public void setSessionid(String sessionid) {
		this.sessionid = sessionid;
	}

	
}